<form class="layui-form layui-form-pane" action="" method="post" style="margin:30px;">
    <div class="layui-form-item">
      <label class="layui-form-label">ID</label>
      <div class="layui-input-block">
        <input type="" name="id"  class="layui-input" lay-verify="required" disabled="true">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">门店名称</label>
      <div class="layui-input-block">
        <input type="" name="store_name"  placeholder="请输入级别名称" class="layui-input" lay-verify="required">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">门店经理</label>
      <div class="layui-input-block">
        <input type="" name="store_manager" placeholder="请输入加价金额" class="layui-input" >
      </div>
    </div>
    <!--  <div class="layui-form-item">
      <label class="layui-form-label">门店地址</label>
      <div class="layui-input-block">
        <input type="" name="" placeholder="此处可以批量添加项目，但不会更新技师队列数据" class="layui-input"  disabled="true">
      </div>
    </div> -->
     
    <div class="layui-form-item">
        <div class="layui-input-block">
          <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
          
        </div>
      </div>
</form>
<script type="text/javascript">
  layui.use('form', function(){
    var form = layui.form;
    form.on('submit(formDemo)', function(data){
      //console.log(serves);
      //layer.msg(JSON.stringify(data.field));
      $.post('suggest_store_edit',data.field,function(data){
        //console.log(data);
        if(data.status){  //添加成功
          layer.msg(data.msg);
          // 一秒后关掉当前窗口
          var index =parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
          setTimeout(function(){
            parent.layer.close(index); //再执行关闭 
            window.parent.location.reload();
          },2000);


        }else{
          layer.msg(data.msg);
        }
      },'json'); 
      return false;
    });

  });
</script>


<script type="text/javascript">
   // 编辑时获取文本的值
  var arr=<?php echo json_encode($list);?>;
  if(arr.length > 0){
    for(var key in arr[0]){
      //console.log(key);
      $("input:not(:radio)[name='"+key+"']").not(":checkbox").val(arr[0][key]);
      $("select[name='"+key+"']").val(arr[0][key]);
      $("input:radio[name='"+key+"'][value='"+arr[0][key]+"']").attr("checked", true);
      //$("input:checkbox[name='serves"+key"']").addClass('layui-form-checked');
      if(key=='serves')var arr1=arr[0][key].split(",");
      //console.log(arr1);
        for(var k1 in arr1){
          var id=arr1[k1];
          //var id=100;
          $("input:checkbox[name='"+id+"']").attr("checked",true);
          //console.log("input:checkbox[name='serves["+id+"]']");
        }
      }
  }

</script>